s1=""
f=0
print("введите текст")
a=input()
for i in a:
    if i=='(' or i=='{' or i=='['or i=='<':
        s1+=i
    if i==')':
        if s1[-1]=='(':
            s1 = s1[:-1]
        else:
            f=1
            break
    if i=='}':
        if s1[-1]=='{':
            s1 = s1[:-1]
        else:
            f=1
            break
    if i==']':
        if s1[-1]=='[':
            s1 = s1[:-1]
        else:
            f=1
            break
    if i=='>':
        if s1[-1]=='<':
            s1 = s1[:-1]
        else:
            f=1
            break
if f==0 and len(s1)==0:
    print("true")
else:
    print("false")